home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1995 May / PC Answers CD-ROM 7 (Future Publishing) (May 1995).iso / vbits / code / swanson / dataxess.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-01-06  |  4.6 KB  |  152 lines

  1. VERSION 2.00
  2. Begin Form DataXess 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Data Access"
  5.    ClientHeight    =   2340
  6.    ClientLeft      =   2280
  7.    ClientTop       =   3210
  8.    ClientWidth     =   7515
  9.    Height          =   2745
  10.    Left            =   2220
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   2340
  13.    ScaleWidth      =   7515
  14.    Top             =   2865
  15.    Width           =   7635
  16.    Begin TextBox txtCounter 
  17.       Height          =   315
  18.       Left            =   6000
  19.       TabIndex        =   2
  20.       Text            =   "50"
  21.       Top             =   600
  22.       Width           =   1300
  23.    End
  24.    Begin CommandButton cmdTrans 
  25.       Caption         =   "Update Records"
  26.       Default         =   -1  'True
  27.       Height          =   450
  28.       Index           =   0
  29.       Left            =   120
  30.       TabIndex        =   0
  31.       Top             =   1080
  32.       Width           =   1935
  33.    End
  34.    Begin CommandButton cmdTrans 
  35.       Caption         =   "Update w/ *Trans"
  36.       Height          =   450
  37.       Index           =   1
  38.       Left            =   120
  39.       TabIndex        =   1
  40.       Top             =   1560
  41.       Width           =   1935
  42.    End
  43.    Begin Label Label2 
  44.       AutoSize        =   -1  'True
  45.       BackStyle       =   0  'Transparent
  46.       Caption         =   "Records:"
  47.       Height          =   195
  48.       Left            =   5175
  49.       TabIndex        =   8
  50.       Top             =   660
  51.       Width           =   780
  52.    End
  53.    Begin Label lblTitle 
  54.       AutoSize        =   -1  'True
  55.       BackStyle       =   0  'Transparent
  56.       Caption         =   "Use Transaction Statements for Bulk Operations"
  57.       FontBold        =   -1  'True
  58.       FontItalic      =   0   'False
  59.       FontName        =   "MS Sans Serif"
  60.       FontSize        =   12
  61.       FontStrikethru  =   0   'False
  62.       FontUnderline   =   0   'False
  63.       ForeColor       =   &H00800000&
  64.       Height          =   300
  65.       Index           =   1
  66.       Left            =   240
  67.       TabIndex        =   7
  68.       Top             =   120
  69.       Width           =   6255
  70.    End
  71.    Begin Label Label1 
  72.       BackStyle       =   0  'Transparent
  73.       Caption         =   "Update records w/o Trans"
  74.       Height          =   255
  75.       Index           =   0
  76.       Left            =   2160
  77.       TabIndex        =   6
  78.       Top             =   1200
  79.       Width           =   3200
  80.    End
  81.    Begin Label lblTrans 
  82.       BackStyle       =   0  'Transparent
  83.       Caption         =   "00.00 secs"
  84.       FontBold        =   -1  'True
  85.       FontItalic      =   0   'False
  86.       FontName        =   "MS Sans Serif"
  87.       FontSize        =   9.75
  88.       FontStrikethru  =   0   'False
  89.       FontUnderline   =   0   'False
  90.       ForeColor       =   &H00800000&
  91.       Height          =   255
  92.       Index           =   0
  93.       Left            =   6000
  94.       TabIndex        =   5
  95.       Top             =   1200
  96.       Width           =   1300
  97.    End
  98.    Begin Label Label1 
  99.       BackStyle       =   0  'Transparent
  100.       Caption         =   "Use BeginTrans && CommitTrans"
  101.       Height          =   255
  102.       Index           =   1
  103.       Left            =   2160
  104.       TabIndex        =   4
  105.       Top             =   1680
  106.       Width           =   3200
  107.    End
  108.    Begin Label lblTrans 
  109.       BackStyle       =   0  'Transparent
  110.       Caption         =   "00.00 secs"
  111.       FontBold        =   -1  'True
  112.       FontItalic      =   0   'False
  113.       FontName        =   "MS Sans Serif"
  114.       FontSize        =   9.75
  115.       FontStrikethru  =   0   'False
  116.       FontUnderline   =   0   'False
  117.       ForeColor       =   &H00800000&
  118.       Height          =   255
  119.       Index           =   1
  120.       Left            =   6000
  121.       TabIndex        =   3
  122.       Top             =   1680
  123.       Width           =   1300
  124.    End
  125. Sub cmdTrans_Click (Index As Integer)
  126. 'If Index=1, we include a BeginTrans/CommitTrans wrapper
  127. 'around the update loop
  128.     Dim db As Database
  129.     Dim tb As Table
  130.     Set db = OpenDatabase("c:\vb\biblio.mdb")
  131.     Set tb = db.OpenTable("Authors")
  132.     screen.MousePointer = 11
  133.     Start# = Timer
  134.     If Index = 1 Then BeginTrans
  135.     For Counter = 1 To Val(txtCounter)
  136.         tb.AddNew
  137.         tb("Author") = Str(Counter)
  138.         tb.Update
  139.     Next Counter
  140.     If Index = 1 Then CommitTrans
  141.     Finish# = Timer
  142.     lblTrans(Index) = Format$(Finish# - Start#, "##.##") & " secs."
  143.     screen.MousePointer = 0
  144.     tb.Close
  145.     db.Close
  146. End Sub
  147. Sub Form_Load ()
  148.     ' Center the form.
  149.     Me.Left = (screen.Width - Me.Width) / 2
  150.     Me.Top = (screen.Height - Me.Height) / 2
  151. End Sub
  152.